package com.blockchainenergy.common.memory.log;

import lombok.Data;

import java.util.LinkedList;

@Data
public class UserMeterLog {
    private int n = 60;// 容量
    private LinkedList<Double> Vs;
    private LinkedList<Double> As;
    private LinkedList<Double> PIAs;
    private LinkedList<Double> PIRs;


    public UserMeterLog() {
        Vs = new LinkedList<>();
        As = new LinkedList<>();
        PIAs = new LinkedList<>();
        PIRs = new LinkedList<>();
    }

    public int getSize() {
        return Vs.size();
    }

    public void add(Double v, Double a, Double pia, Double pir) {
        int cur = Vs.size();
        Vs.add(v);
        As.add(a);
        PIAs.add(pia);
        PIRs.add(pir);
        if (cur >= n) {
            Vs.removeFirst();
            As.removeFirst();
            PIAs.removeFirst();
            PIRs.removeFirst();
        }
    }
}
